import {
    legacy_createStore,
    applyMiddleware
} from 'redux'

import { ALLSTATE,ALLACTION,SETLIST,SETLISTACTIONTYPE } from '../tyeps/store.d'
import logger from 'redux-logger'
import thunk from 'redux-thunk'

const initialState = {
    list:[]
}

 const reduer = (state:ALLSTATE = initialState, { type, payload }:ALLACTION) => {
  switch (type) {

  case SETLIST:
    state.list = payload;
    return { ...state}

  default:
    return state
  }
}

const store = legacy_createStore(reduer,applyMiddleware(logger,thunk))


export default store
